package com.alquimia.identityaccess.rest.controller.fixture;

import com.alquimia.identityaccess.application.events.user.UserEvent;
import com.alquimia.identityaccess.domain.model.*;

import java.util.UUID;

/**
 * Created by Ivo on 14/07/2014.
 */
public class UserDataFixture {

    public static final UUID key = UUID.fromString("f3512d26-72f6-4290-9265-63ad69eccc13");

    public static User customUser() {
        User user = new User(
                new UserId(key),
                "parunrua.ivo",
                "12345678",
                person()
        );
        return user;
    }

    public static User customUserFullName(String aFirstName, String aLastName) {
        User user = new User(
                new UserId(key),
                "parunrua.ivo",
                "12345678",
                person(aFirstName, aLastName)
        );
        return user;
    }

    public static User customUserPassword(String aChangedPassword) {
        User user = new User(
                new UserId(key),
                "parunrua.ivo",
                aChangedPassword,
                person()
        );
        return user;
    }

    public static User customUserEmailAddress(String aChangedEmailAddress) {
        User user = new User(
                new UserId(key),
                "parunrua.ivo",
                "12345678",
                person(aChangedEmailAddress)
        );
        return user;
    }

    public static Person person(String aFirstName, String aLastName) {
        return new Person(
                new FullName(aFirstName, aLastName),
                new EmailAddress("parun.rua.ivo@gmail.com")
        );
    }

    public static Person person(String aChangedEmailAddress) {
        return new Person(
                new FullName("Ivo", "Parun Rua"),
                new EmailAddress(aChangedEmailAddress)
        );
    }

    public static Person person() {
        return new Person(
                new FullName("Ivo", "Parun Rua"),
                new EmailAddress("parun.rua.ivo@gmail.com")
        );
    }

    public static String updateEmailAddressJSON() {
        return "{ \"userId\":\"f3512d26-72f6-4290-9265-63ad69eccc13\",\"emailAddress\":\"prueba@prueba.com\"} ";
    }

    public static String userJSON() {
        return "{ \"username\":\"parunrua.ivo\",\"password\":\"12345678\",\"firstName\": \"ivo\", \"lastName\":\"Parun Rua\",\"emailAddress\":\"parun.rua.ivo@gmail.com\"} ";
    }

    public static String updateFullNameJSON() {
        return "{ \"userId\":\"f3512d26-72f6-4290-9265-63ad69eccc13\",\"firstName\": \"Juan\", \"lastName\":\"Perez\"} ";
    }

    public static String updatePasswordJSON() {
        return "{ \"userId\":\"f3512d26-72f6-4290-9265-63ad69eccc13\",\"currentPassword\":\"87654321\",\"changedPassword\":\"87654321\"} ";
    }

    public static String authenticateJSON() {
        return "{ \"username\":\"parunrua.ivo\",\"password\":\"12345678\"} ";
    }

    public static UserEvent customUserEvent() {
        return new UserEvent(customUser());
    }


}
